References
Maintenance Commands
Maintenance commands perform administrative operations on the database and application. They run with full privileges and are available only to admin users. You can execute maintenance commands through the Admin UI (Schema → Admin menu), the REST API (POST /structr/rest/maintenance/<command>), or programmatically using the maintenance() function. For details on execution methods, see the Maintenance chapter.
changeNodePropertyKey
Migrates property values from one property key to another.
Parameters
| Name | Description | Optional |
|---|---|---|
oldKey |
Source property key | no |
newKey |
Target property key | no |
type |
Node type to migrate. If omitted, all nodes are migrated. | yes |
Use this command when you rename a property in your schema and need to move existing data to the new key.
clearDatabase
Removes all nodes and relationships from the database.
Notes
- Warning: This action cannot be reversed. It deletes your entire application and all data, including non-Structr nodes and relationships.
copyRelationshipProperties
Copies property values from one key to another on all relationships.
Parameters
| Name | Description | Optional |
|---|---|---|
sourceKey |
Source property key | no |
destKey |
Destination property key | no |
createLabels
Updates Neo4j type labels on nodes to match their Structr type hierarchy.
Parameters
| Name | Description | Optional |
|---|---|---|
type |
Limit to nodes of this type | yes |
removeUnused |
Remove labels without corresponding types (default: true) | yes |
Use this command after changing type inheritance or when labels are out of sync.
The command reads each node’s type property, resolves the inheritance hierarchy, and creates a label for each type in the chain.
Notes
- Only works for nodes that have a value in their
typeproperty.
deleteSpatialIndex
Removes legacy spatial index nodes from the database.
Deletes all nodes with bbox and gtype properties.
Notes
- This is a legacy command for cleaning up old spatial indexes. You will probably never need it.
detachedNodes
Reports (and optionally repairs) DOM nodes that belong to no page.
A DOM node that has no ownerDocument still renders, because rendering walks the parent, so the
application looks healthy. Deployment export walks documents instead - the pages and the
ShadowDocument - so such a node is silently left out of the export, while every page that
references it keeps the reference. The next import then produces empty page shells, and a page
whose root element is such a node fails to import at all.
The command reports three kinds:
ADOPTABLE: no document of its own, but an element above it has one. This is damage, and the
repair gives it that document.ORPHANED_MASTER: no document and no parent, but instances of it still exist. It is a shared
component that lost the ShadowDocument, and the repair puts it back.RECYCLE_BIN: no document, no parent, nothing referring to it. That is how deleted content
looks in Structr, so it is reported and never touched.
It runs as a DRY RUN unless repair=true is passed.
Notes
- The same repair runs automatically at startup (see MigrationService), so this command is for inspecting an instance or repairing one without restarting it.
migrate
Runs the startup migrations, either reporting what they would change or applying them.
Structr migrates data and schema at startup, governed by application.migration.mode. This
command runs the same steps on a running instance, with the mode given as a parameter instead
of read from the configuration.
mode=dry-run(default): every step runs and logs what it would change, and the change is
rolled back. Each step is rolled back on its own, so the command never holds more in one
transaction than that step would have committed by itself.mode=apply: the steps migrate for real.
Two of the steps only ever read and report: the check for notion properties that need attention,
and the report on calls to the HTTP functions that still use the pre-7.0 signature. Those run in
both modes.
The results are written to the server log, not returned to the caller.
Notes
- Unlike the dry run at startup, this one does not stop the instance: it is already running, and the rollback leaves the database as it was.
- On a cluster the migrations run on the coordinator only, so this command does nothing on the other members.
deployData
Exports or imports application data.
Parameters
| Name | Description | Optional |
|---|---|---|
mode |
import or export |
no |
source |
Source folder path (required for import) | yes |
target |
Target folder path (required for export) | yes |
types |
Comma-separated list of types to export | yes |
Exports or imports data only, not the schema or application structure. Use this for backing up or migrating data between environments.
deploy
Exports or imports a Structr application without data.
Parameters
| Name | Description | Optional |
|---|---|---|
mode |
import or export |
no |
source |
Source folder path (required for import) | yes |
target |
Target folder path (required for export) | yes |
extendExistingApp |
If true, import merges with existing application instead of replacing it | yes |
Exports or imports the schema, pages, files, and security configuration. The export creates a text-based format suitable for version control.
This is the same mechanism used by the Dashboard deployment feature.
directFileImport
Imports files from a server filesystem directory into Structr’s virtual filesystem.
Parameters
| Name | Description | Optional |
|---|---|---|
source |
Source directory path on the server | no |
mode |
copy (keep originals) or move (delete after import) |
no |
existing |
Handle duplicates: skip, overwrite, or rename (default: skip) |
yes |
index |
Enable fulltext indexing for imported files (default: true) | yes |
Notes
- When using Docker, copy files into the container first or use a mounted volume.
fixNodeProperties
Converts property values that were stored with an incorrect type.
Parameters
| Name | Description | Optional |
|---|---|---|
type |
Node type to fix | no |
name |
Specific property to fix (default: all properties) | yes |
Use this command after changing a property’s type in the schema, for example from String to Integer.
flushCaches
Clears all internal caches.
Use this command to reduce memory consumption or resolve cache invalidation issues.
letsencrypt
Creates or renews an SSL certificate using Let’s Encrypt.
Parameters
| Name | Description | Optional |
|---|---|---|
server |
staging (test certificates) or production (valid certificates) |
no |
challenge |
Override the configured challenge method (http for HTTP-01 validation, dns for DNS-01) |
yes |
wait |
Override the configured wait time in seconds before authorizing challenge | yes |
reload |
Reload HTTPS certificate without restart (default: false) | yes |
verbose |
Enables verbose logging (default: false | yes |
keepChallengeFiles |
Enables keeping the challenge files (default: false | yes |
Notes
- The
letsencrypt.domainssetting must contain the full domain name (or space-separated full domain names) for the certificate. - For mode=dns, a user-defined method
onAcmeChallengeis called to enable automating the creation of the required TXT records. Parameters are { type: ‘dns’, domain:, record: , digest: }. - If a user-defined method
afterAcmeChallengeexists, it will be called after a certificate retrieval. Parameters are{ success: boolean, errors: [string...] }.
maintenanceMode
Enables or disables the maintenance mode.
Parameters
| Name | Description | Optional |
|---|---|---|
action |
enable or disable |
no |
When the maintenance mode is started, the following services are shut down:
- FtpService
- HttpService
- SSHService
- AgentService
- CronService
- StorageSyncService
- LDAPService
- MailService
After a short delay, the following services are restarted on different ports:
- FtpService
- HttpService
- SSHService
Notes
- Active processes will keep running until they are finished. If for example a cron job is running, it will not be halted. Only the services are stopped so no new processes are started.
rebuildIndex
Rebuilds database indexes by removing and re-adding all indexed properties.
Parameters
| Name | Description | Optional |
|---|---|---|
type |
Limit to this node type | yes |
relType |
Limit to this relationship type | yes |
mode |
nodesOnly or relsOnly |
yes |
Use this command after bulk imports or when search results are inconsistent.
setNodeProperties
Sets property values on all nodes of a given type.
Parameters
| Name | Description | Optional |
|---|---|---|
type |
Node type to modify | no |
newType |
New value for the type property |
yes |
All parameters except type and newType are treated as property key-value pairs to set on matching nodes.
Notes
- Warning: After changing the
typeproperty, runcreateLabelsto update node labels. Otherwise, nodes may not be accessible through their new type.
setRelationshipProperties
Sets property values on all relationships of a given type.
Parameters
| Name | Description | Optional |
|---|---|---|
type |
Relationship type to modify | no |
All parameters except type are treated as property key-value pairs to set on matching relationships.
Notes
- You cannot change a relationship’s type with this command. To change the type, delete and recreate the relationship.
setUuid
Generates UUIDs for nodes and relationships that lack an id property.
Parameters
| Name | Description | Optional |
|---|---|---|
type |
Limit to this node type | yes |
relType |
Limit to this relationship type | yes |
allNodes |
Apply to all nodes | yes |
allRels |
Apply to all relationships | yes |